// pages/ingroups/ingroups.js
// 名片所在的微信群列表

const utils = require("../../utils/util.js");
Page({
  ...utils.defaultShare,
  data: {
    groupList: [],
    cardId: ""
  },
  onLoad(options) {
    console.log("options", options);
    this.setData({
      cardId: options.cardId || ""
    });
  },
  onShow() {
    this.getGroupList();
  },
  getGroupList() {
    utils
      .ajax("/v1/bcs/queryUserCardExistGroups.do", {
        cardId: this.data.cardId
      })
      .then(res => {
        if (res.code === "000000") {
          this.setData({
            groupList: res.data.groups || []
          });
        } else {
          console.log(res.message || "获取标签失败");
        }
      })
      .catch(res => {});
  }
});
